<template>
    <div class="xkl-padding-box" :class="getClass()">
        <div class="content">
            <slot></slot>
        </div>
        <div class="after">
            <slot name="after"></slot>
        </div>
    </div>
</template>
<script setup lang="ts">
defineOptions({ name: 'XklPaddingBox' })
const props = defineProps({
    padding: {
        type: Array,
        default: []
    }
})
const { padding } = props


const getClass = () => {
    const classArr: string[] = []
    switch (padding.length) {
        case 1:
            classArr.push('pd-' + padding[0])
            break;
        case 2:
            classArr.push('ptb-' + padding[0], 'plr-' + padding[1])
            break
        case 3:
            classArr.push('pt-' + padding[0], 'pr-' + padding[1], 'pb-' + padding[2])
            break
        case 4:
            classArr.push('pt-' + padding[0], 'pr-' + padding[1], 'pb-' + padding[2], 'pl-' + padding[3])
            break
        default:
            classArr.push('pb-' + 20)
            break;
    }
    return classArr
}

</script>
<style lang="scss" scoped>
.xkl-padding-box {
    display: flex;
    align-items: center;

    .content,
    .after {
        display: flex;
        align-items: center;
    }
}
</style>